package cn.luckdou.system.model.we_chat;

import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;

/**
 * <p>
 * 
 * </p>
 *
 * @author Dadou
 * @since 2017-08-08
 */
@TableName("tb_we_chat")
public class WeChat extends Model<WeChat> {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
	private Long id;
	/**
	 * subscribe
	 */
	private Integer subscribe;
    /**
     * open_id
     */
	@TableField("open_id")
	private String openId;
    /**
     * union_id
     */
	@TableField("union_id")
	private String unionId;
    /**
     * add_date
     */
	@TableField("remove_date")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date removeDate;
    /**
     * subscribe_time
     */
	@TableField("subscribe_time")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date subscribeTime;
    /**
     * nike_name
     */
	@TableField("nike_name")
	private String nikeName;
    /**
     * sex
     */
	private Integer sex;
    /**
     * language
     */
	private String language;
    /**
     * head_img_url
     */
	@TableField("head_img_url")
	private String headImgUrl;
    /**
     * city
     */
	private String city;
    /**
     * province
     */
	private String province;
    /**
     * country
     */
	private String country;
    /**
     * group_id
     */
	@TableField("group_id")
	private Integer groupId;
    /**
     * name
     */
	private String name;
    /**
     * 状态 1正常 0停用
     */
	private Integer status;
    /**
     * 创建时间
     */
	@TableField("created_time")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date createdTime;
    /**
     * 修改时间
     */
	@TableField("updated_time")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date updatedTime;
    /**
     * 删除时间
     */
	@TableField("deleted_time")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date deletedTime;
	/**
	 * 无参构造方法
	 */
	public WeChat(){
	}
	public WeChat(JSONObject json){
		this.subscribe=json.getInt("subscribe");
		this.openId=json.getString("openid");
		this.nikeName=json.getString("nickname");
		this.sex=json.getInt("sex");
		this.language=json.getString("language");
		this.city=json.getString("city");
		this.province=json.getString("province");
		this.country=json.getString("country");
		this.headImgUrl=json.getString("headimgurl");
		this.subscribeTime=new Date(json.getLong("subscribe_time")*1000L);
		this.groupId=json.getInt("groupid");
		this.createdTime=new Date();

	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId =StringUtils.isNotBlank(openId)?openId:null;
	}

	public String getUnionId() {
		return unionId;
	}

	public void setUnionId(String unionId) {
		this.unionId =StringUtils.isNotBlank(unionId)?unionId:null;
	}

	public Date getRemoveDate() {
		return removeDate;
	}

	public void setRemoveDate(Date removeDate) {
		this.removeDate = removeDate;
	}

	public Date getSubscribeTime() {
		return subscribeTime;
	}

	public void setSubscribeTime(Date subscribeTime) {
		this.subscribeTime = subscribeTime;
	}

	public String getNikeName() {
		return nikeName;
	}

	public void setNikeName(String nikeName) {
		this.nikeName =StringUtils.isNotBlank(nikeName)?nikeName:null;
	}

	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex =sex;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language =StringUtils.isNotBlank(language)?language:null;
	}

	public String getHeadImgUrl() {
		return headImgUrl;
	}

	public void setHeadImgUrl(String headImgUrl) {
		this.headImgUrl =StringUtils.isNotBlank(headImgUrl)?headImgUrl:null;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city =StringUtils.isNotBlank(city)?city:null;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province =StringUtils.isNotBlank(province)?province:null;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country =StringUtils.isNotBlank(country)?country:null;
	}

	public Integer getGroupId() {
		return groupId;
	}

	public void setGroupId(Integer groupId) {
		this.groupId = groupId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name =StringUtils.isNotBlank(name)?name:null;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Date getCreatedTime() {
		return createdTime;
	}

	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}

	public Date getUpdatedTime() {
		return updatedTime;
	}

	public void setUpdatedTime(Date updatedTime) {
		this.updatedTime = updatedTime;
	}

	public Date getDeletedTime() {
		return deletedTime;
	}

	public void setDeletedTime(Date deletedTime) {
		this.deletedTime = deletedTime;
	}

	public Integer getSubscribe() {
		return subscribe;
	}

	public void setSubscribe(Integer subscribe) {
		this.subscribe = subscribe;
	}

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

}
